package com.boarsoft.boar.app.biz;

import java.util.List;

import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.boarsoft.boar.app.AppInstFileBiz;
import com.boarsoft.boar.entity.AppInstFile;
import com.boarsoft.boar.entity.FileInfo;
import com.boarsoft.hibernate.biz.SimpleBizImpl;

/**
 * 管理应用实例与文件版本的关系
 * 
 * @author Mac_J
 *
 */
@Component("appInstFileBiz")
public class AppInstFileBizImpl extends SimpleBizImpl implements AppInstFileBiz {
	@Override
	@Transactional(readOnly = true)
	public List<FileInfo> list(String appInstId) {
		StringBuilder sb = new StringBuilder();
		sb.append("select f from ").append(AppInstFile.class.getName());
		sb.append(" aif join aif.fileVersion fv join fv.file f where aif.appInstId = '");
		sb.append(appInstId).append("'");
		return dao.list(sb.toString(), FileInfo.class);
	}
}